{% macro tag(item) %}
{% set url = helpers.join('/', locale, 'tags', item) %}
{#
  chrome-[version] tags are supported but don't have translations, so we special case them to
  "Chrome [version]".
#}
{% if item.startsWith('chrome-') %}
  {% set title = item | replace('-', ' ') | capitalize %}
{% else %}
  {% set title = ('i18n.tags.' + item) | i18n(locale) %}
  {% if not title %}
    {# TODO: i18n failure throws, but it would be nice to fall back to the raw text #}
    {# Fall back to the raw text of the tag. #}
    {% set title = item %}
  {% endif %}
{% endif %}

{% if title and url %}
  <a
    class="tag-pill surface decoration-none hairline color-secondary-text type--label weight-regular rounded-lg"
    href="{{ url }}"
    >{{ title }}</a>
{% endif %}
{% endmacro %}
